//
// Created by iimt on 21-3-20.
//

#ifndef VISUALORIENTATION_KSDemoDlgtaskparamerUI_H
#define VISUALORIENTATION_KSDemoDlgtaskparamerUI_H



#include <QDialog>
#include <QPushButton>
#include <QLineEdit>
#include <QLabel>
#include <QComboBox>
#include <QGroupBox>
#include <QTableView>
#include <QTimer>
#include <QtSql/QSqlTableModel>
#include <QtSql/QSqlDatabase>
#include <driver/IIMTDriver.h>
#include <QStandardItemModel>
#include <driver/IIMTDriver.h>
/**
 * sukai
 * 21-3-20
 * 测试 sqllite
 */

class KSDemoDlgtaskparamer : public QDialog
{
Q_OBJECT

    enum {UPDATE, INSERT};
    int m_operator;

public:
    explicit KSDemoDlgtaskparamer(QWidget *parent = 0 );
    ~KSDemoDlgtaskparamer();

private:

    void UiInit();
    //sukai 填充数据
    void setdata(QList<QMap<QString, QString> > kSDemoDlg_dictionarie_list);
    //sukai 发送数据
    void sendMsg(QString msg);
    //sukai 设置返回函数
    void setCallBack();

    void onUpdate();
    //sukai //增加表格列名
    void addHeaderData();
    //恢复数据更新一下
    function<void(int)> kSDemoDlg_dictionarie_flg_CallBack;


protected slots:
    void onNewButtonClicked();
    void onQueryButtonClicked();
    void onUpdateButtonClicked();
    void onDeleteButtonClicked();
    void onRefreshButtonClicked();
    void onPrimaryKeyLineEditEmpty(const QString & text);
    void onCurrentTableViewClicked(const QModelIndex & index);
    void onOKButtonClicked();
    void onCancelButtonClicked();

private:
    QSqlDatabase m_db;
    QString m_DBName;
    QString m_DBTableName;
    //sukai
    //QList<QMap<QString, QString>> maptestInfos_list;
   // QList<QMap<QString, QString>> mapdictionarie_list;
    QList<TestInfo> test_Infos;
    //sukai 列的所有名称
    QList<QString> Label_names;
    int column;
    QTimer* updateTimer;
private:
    QTableView* m_TabView;

    //sukai
    QStandardItemModel * item_model;

private:
    QList<QLineEdit*> m_infoEditList;
    QList<QLabel*> m_infoLabelList;
    QPushButton m_OKButton;
    QPushButton m_CancelButton;

private:

    /*所有用户信息容器组*/
    QGroupBox m_Group;

    QLabel m_PrimaryKeyLabel;
    QLineEdit m_PrimaryKeyLineEdit;
    QPushButton m_QueryButton;

    QPushButton m_NewButton;
    QPushButton m_UpdateButton;
    QPushButton m_DeleteButton;
    QPushButton m_RefreshButton;
    /*所选择用户信息容器组*/
    QGroupBox m_SelectGroup;
    QString connectionName = "KSDemoDlgtaskparamer_ui";

public:
    //字典数据
    void setKSDemoDlg_dictionarie_flg_CallBack(function<void(int)> kSDemoDlg_dictionarie_flg_CallBack);
    //灵活增加界面右侧数据显示形式
    void addrow();
};




#endif //VISUALORIENTATION_KSDemoDlgtaskparamerUI_H
